#ifndef EvtHandler_First
#define EvtHandler_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Object.h"
#include "Token.h"

class Clipper;
class Menu;
class Command;

enum EvtFlags {
	eEvtDefault = eObjDefault,
	eEvtLast    = eObjLast + 0
};

//---- EvtHandler --------------------------------------------------------------

class EvtHandler: public Object {
public:
	MetaDef(EvtHandler);

	EvtHandler();
	EvtHandler(int id);
	~EvtHandler();

	int GetId();
	void SetId(int i);

	virtual EvtHandler *GetNextHandler();
	EvtHandler *FindNextHandlerOfClass(Class *cla);

	virtual Menu *GetMenu();
	virtual void DoSetupMenu(Menu*);
	virtual Command *DoMenuCommand(int);
	virtual void PerformCommand(Command *);
	virtual bool SetFirstHandler(EvtHandler*);
	virtual bool KbdFocus(bool in);
	virtual Command *Input(Point lp, Token &t, Clipper *cl);

	virtual void Send(int id= cIdNone, int part= cPartAnyChange, void *val= 0);
	virtual void Control(int id, int part, void *val);
	virtual void SendDown(int id, int part, void *val);
	virtual void ExtCommand(int from, char *req, char *args, int len,
							char *&ret, int &retlen);
	virtual void InputKbd(Token &t);

	OStream& PrintOn(OStream&);
	IStream& ReadFrom(IStream&);

private:
	int id_;
};

extern EvtHandler *gFirstHandler;

#endif

